package jfae.core.configuration;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

import jfae.core.properties.FieldInfo;
import jfae.core.properties.parsers.PropertyHandler;
import jfae.core.properties.parsers.annotation.AnnotationHandler;

public class JFaeConfiguration {

	private static final LinkedHashMap<String, AnnotationHandler<?>> ANNOTATIONS_HANDLERS = new LinkedHashMap<String, AnnotationHandler<?>>();
	private static final LinkedHashMap<String, PropertyHandler<FieldInfo<?>>> PROPERTIES_HANDLERS = new LinkedHashMap<String, PropertyHandler<FieldInfo<?>>>();

	public static List<AnnotationHandler<?>> getAnnotationsHandlers() {
		return new ArrayList<AnnotationHandler<?>>(ANNOTATIONS_HANDLERS.values());
	}

	public static List<PropertyHandler<FieldInfo<?>>> getPropertiesHandlers() {
		return new ArrayList<PropertyHandler<FieldInfo<?>>>(PROPERTIES_HANDLERS.values());
	}
	
	static void add(String contributionId, AnnotationHandler<?> annotationHandler){
		ANNOTATIONS_HANDLERS.put(contributionId, annotationHandler);
	}

	static void add(String contributionId, PropertyHandler<FieldInfo<?>> propertyHandler){
		PROPERTIES_HANDLERS.put(contributionId, propertyHandler);
	}
	
	static void reset(){
		ANNOTATIONS_HANDLERS.clear();
		PROPERTIES_HANDLERS.clear();
	}
}
